# 为了统计学生人数，可以给 Student 类增加一个类属性，每创建一个实例，该属性自动增加：
class Student(object):
    count = 0

    def __init__(self,name):
        self.name = name
        self.__set_count()

    def __set_count(self):
        Student.count = Student.count + 1


# 测试
stu1 = Student('wang')
print('count=', stu1.count)
stu2 = Student('yang')
print('count=', stu2.count)
stu3 = Student('li')
print('count=', stu3.count)



